package com.runvp.common.enums;


/**
 * 产品类型 (充电桩:biz,其他:other)
 * @author xukk_dp
 */

public enum ProductType implements BaseEnumInterface {


    BIZ("biz", "充电桩"),
    WATER("other", "其他");

    private final String code;
    private final String desc;
    private String defaulted;

    @Override
    public String getDefaulted() {
        return defaulted;
    }


    ProductType(String code, String desc, String defaulted) {
        this.code = code;
        this.desc = desc;
        this.defaulted = defaulted;
    }

    ProductType(String code, String desc) {
        this.code = code;
        this.desc = desc;
    }


    @Override
    public String getCode() {
        return code;
    }
    @Override
    public String getDesc() {
        return desc;
    }


    /**
     * 获取枚举描述
     *
     * @param key
     * @return boolean true：包含，  false：不包含
     */
    public static String getDesc(String key) {
        if (null == key || "".equals(key)) {
            return "未知";
        }
        for (ProductType e : ProductType.values()) {
            if (key.equals(e.getCode())) {
                return e.getDesc();
            }
        }
        return "未知";
    }
}
